//
//  LCBaseDatabase+DBCreate.m
//  LCFMDB
//
//  Created by jiukuyinyue on 2017/10/31.
//  Copyright © 2017年 LC. All rights reserved.
//

#import "LCBaseDatabase+DBCreate.h"

@implementation LCBaseDatabase (DBCreate)
- (void)createDbWithSqliteName:(NSString *)sqliteName
                        sqlStr:(NSString *)sql
                   succBlock:(void(^)(void))succBlock
                   failBlock:(void(^)(void))failBlock {
    
    [self.db inDatabase:^(FMDatabase *db) {

        BOOL isCreate = [db executeUpdate:sql];
        if (isCreate) {
            succBlock();
        }else{
            failBlock();

        }
    }];
}

/**
 *  在kDbSqlName @"JKFuYinDB.sqlite"里创建表 {
 *  创建EssayInfoTable {
 */
- (void)createEssayParametersListTable {
    
    NSString *sqliteName = kDbSqlName;//库
    NSString *sql = CREATE_ESSAYTABLE;
    
    [self createDbWithSqliteName:sqliteName
                          sqlStr:(NSString *)sql
                       succBlock:^{
        NSLog(@"创建表成功");
    } failBlock:^{
        NSLog(@"创建表失败");
    }];
}

///云头条文章
- (void)createEssayParameters {
        [self createEssayParametersListTable];
}


 

@end
